﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orid.Management.Statistics.Tools.Decomposition.Config;
using Orid.Management.Statistics.Tools.Decomposition.Model;

namespace Orid.Management.Statistics.Tools.Decomposition.Data
{
    class UploadJobStoreOnline:UploadJobStore
    {
        string connectString, tableName;

        public UploadJobStoreOnline(string connectString)
        {
            this.connectString = connectString;

                //Setting.SettingInstance.DBAddress_Online;
            //[UploadJobStore]
            tableName = "[FutureManagement_Jobs].[FutureMa].[UploadJobStore]";
        }

        public override ModelUploadJobStore GetEntryDuration(Guid? jobID, int? accountID)
        {
            try
            {

                if ((jobID == null) ||(accountID == null))
                {
                    return null;
                }

                return GetEntryDuration(jobID, accountID, connectString, tableName);

            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw (new Exception(ex.Message));
            }
        }

        public override void GetFGEntryResult(Guid? jobID, int? accountID , ref ModelFrameResult frameResult)
        {
            try
            {

                if ((jobID == null) || (accountID == null))
                {
                    return  ;
                }

                   GetFGEntryResult(jobID, accountID, connectString, tableName,ref frameResult);

            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw (new Exception(ex.Message));
            }
        }
    }
}
